﻿using M_Purchase.Api.Appliction.Command.PurchCommand;
using M_Purchase.Domain;
using M_Purchase.Repository.PurchaseInterface;
using MediatR;

namespace M_Purchase.Api.Appliction.CommandHandlers.PurchCommandHandler
{
    /// <summary>
    /// 显示供应商
    /// </summary>
    public class SupplierListDCommandHandler : IRequestHandler<SupplierListDCommand, List<Supplier>>
    {
        private readonly ISupplierRepository _supplierRepository;
        public SupplierListDCommandHandler(ISupplierRepository supplierRepository)
        {
            _supplierRepository = supplierRepository;
        }
        public async Task<List<Supplier>> Handle(SupplierListDCommand request, CancellationToken cancellationToken)
        {
            return await _supplierRepository.GetAllAsync();
        }
    }
}
